#ifndef _UIWEBVIEW_H_
#define _UIWEBVIEW_H_

#include <QNetworkAccessManager>
#include <QGraphicsProxyWidget>
#include <QUrl>
class QNetworkRequest;

#include <UIKit/UIResponder.h>
class UIWindow;

class UIWebViewPrivate;
class UIWebView : public QGraphicsProxyWidget, public UIResponder {
    public:
        UIWebView (QGraphicsItem * parent = 0);
        ~UIWebView();

        void load (const QUrl& url);
        void load (const QNetworkRequest& request,
                   QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
                   const QByteArray& body = QByteArray());

        void setContent (const QByteArray& data,
                         const QString& mimeType = QString(),
                         const QUrl& baseUrl = QUrl());
        void setHtml (const QString& html, 
                      const QUrl& baseUrl = QUrl());

        qreal zoomFactor (void) const;
        void setZoomFactor (qreal factor);

        UIWindow *window (void) const;

    protected:
        virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
        virtual void mousePressEvent (QGraphicsSceneMouseEvent *event);
        virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event);

        virtual QPointF scrollOffset (void) const;
        virtual void setScrollOffset (const QPointF& pos);

    private:
        UIWebViewPrivate *d;
};

#endif /* !_UIWEBVIEW_H_ */

